diff --git a/src/main/java/net/floodlightcontroller/statistics/web/BandwidthResource.java b/src/main/java/net/floodlightcontroller/statistics/web/BandwidthResource.java
index a09e5f9e0d4d49fce8467f7825f0310eaa981b52..55b2e619a7b2e4d5d09e9881585dd5838577133f 100644
--- a/src/main/java/net/floodlightcontroller/statistics/web/BandwidthResource.java
+++ b/src/main/java/net/floodlightcontroller/statistics/web/BandwidthResource.java
@@ -17,59 +17,63 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 public class BandwidthResource extends ServerResource {
-	private static final Logger log = LoggerFactory.getLogger(BandwidthResource.class);
+    private static final Logger log = LoggerFactory.getLogger(BandwidthResource.class);
 
-	@Get("json")
-	public Object retrieve() {
-		IStatisticsService statisticsService = (IStatisticsService) getContext().getAttributes().get(IStatisticsService.class.getCanonicalName());
-		IOFSwitchService switchService = (IOFSwitchService) getContext().getAttributes().get(IOFSwitchService.class.getCanonicalName());
+    @Get("json")
+    public Object retrieve() {
+        IStatisticsService statisticsService = (IStatisticsService) getContext().getAttributes().get(IStatisticsService.class.getCanonicalName());
+        IOFSwitchService switchService = (IOFSwitchService) getContext().getAttributes().get(IOFSwitchService.class.getCanonicalName());
 
-		String d = (String) getRequestAttributes().get(SwitchStatisticsWebRoutable.DPID_STR);
-		String p = (String) getRequestAttributes().get(SwitchStatisticsWebRoutable.PORT_STR);
+        String d = (String) getRequestAttributes().get(SwitchStatisticsWebRoutable.DPID_STR);
+        String p = (String) getRequestAttributes().get(SwitchStatisticsWebRoutable.PORT_STR);
 
-		DatapathId dpid = DatapathId.NONE;
+        DatapathId dpid = DatapathId.NONE;
 
-		if (!d.trim().equalsIgnoreCase("all")) {
-			try {
-				dpid = DatapathId.of(d);
-			} catch (Exception e) {
-				log.error("Could not parse DPID {}", d);
-				return Collections.singletonMap("ERROR", "Could not parse DPID" + d);
-			}
-		} /* else assume it's all */
+        if (!d.trim().equalsIgnoreCase("all")) {
+            try {
+                dpid = DatapathId.of(d);
+            } catch (Exception e) {
+                log.error("Could not parse DPID {}", d);
+                return Collections.singletonMap("ERROR", "Could not parse DPID " + d);
+            }
+        } /* else assume it's all */
 
-		OFPort port = OFPort.ALL;
-		if (!p.trim().equalsIgnoreCase("all")) {
-			try {
-				port = OFPort.of(Integer.parseInt(p));
-			} catch (Exception e) {
-				log.error("Could not parse port {}", p);
-				return Collections.singletonMap("ERROR", "Could not parse port" + p);
-			}
-		}
+        OFPort port = OFPort.ALL;
+        if (!p.trim().equalsIgnoreCase("all")) {
+            try {
+                port = OFPort.of(Integer.parseInt(p));
+            } catch (Exception e) {
+                log.error("Could not parse port {}", p);
+                return Collections.singletonMap("ERROR", "Could not parse port " + p);
+            }
+        }
 
-		Set<SwitchPortBandwidth> spbs;
-		if (dpid.equals(DatapathId.NONE)) { /* do all DPIDs */
-			if (port.equals(OFPort.ALL)) { /* do all ports */
-				spbs = new HashSet<SwitchPortBandwidth>(statisticsService.getBandwidthConsumption().values());
-			} else {
-				spbs = new HashSet<SwitchPortBandwidth>();
-				for (DatapathId id : switchService.getAllSwitchDpids()) {
-					SwitchPortBandwidth spb = statisticsService.getBandwidthConsumption(id, port);
-					if (spb != null) {
-						spbs.add(spb);
-					}
-				}
-			}
-		} else {
-			spbs = new HashSet<SwitchPortBandwidth>();
-			for (OFPortDesc pd : switchService.getSwitch(dpid).getPorts()) {
-				SwitchPortBandwidth spb = statisticsService.getBandwidthConsumption(dpid, pd.getPortNo());
-				if (spb != null) {
-					spbs.add(spb);
-				}
-			}
-		}
-		return spbs;
-	}
+        Set<SwitchPortBandwidth> spbs;
+        if (dpid.equals(DatapathId.NONE)) { /* do all DPIDs */
+            if (port.equals(OFPort.ALL)) { /* do all ports --> do all DPIDs; do all ports */
+                spbs = new HashSet<SwitchPortBandwidth>(statisticsService.getBandwidthConsumption().values());
+            } else {
+                spbs = new HashSet<SwitchPortBandwidth>();
+                for (DatapathId id : switchService.getAllSwitchDpids()) { /* do all DPIDs; do specific port */
+                    SwitchPortBandwidth spb = statisticsService.getBandwidthConsumption(id, port);
+                    if (spb != null) {
+                        spbs.add(spb);
+                    }
+                }
+            }
+        } else { /* do specific DPID */
+            if (!port.equals(OFPort.ALL)) { /* do specific port --> do specific DPID; do specific port */
+                spbs = new HashSet<SwitchPortBandwidth>(Collections.singleton(statisticsService.getBandwidthConsumption(dpid, port)));
+            } else {
+                spbs = new HashSet<SwitchPortBandwidth>();
+                for (OFPortDesc pd : switchService.getSwitch(dpid).getPorts()) { /* do specific DPID; do all ports */
+                    SwitchPortBandwidth spb = statisticsService.getBandwidthConsumption(dpid, pd.getPortNo());
+                    if (spb != null) {
+                        spbs.add(spb);
+                    }
+                }
+            }
+        }
+        return spbs;
+    }
 }
\ No newline at end of file