     return buf
 
   # Fetches a packet from the port
-  get: (scope) ->
-    buf = @getBuffer scope
+  get: (scope, idx) ->
+    buf = @getBuffer scope, idx
     return if @options.control then buf[buf.length - 1] else buf.shift()
 
   # Returns true if port contains packet(s) matching the validator
-  has: (scope, validate) ->
-    buf = @getBuffer scope
+  has: (scope, idx, validate) ->
+    unless @isAddressable()
+      validate = idx
+      idx = null
+    buf = @getBuffer scope, idx
     return false unless buf?.length
     for packet in buf
       return true if validate packet
     false
 
   # Returns the number of data packets in an inport
-  length: (scope) ->
-    buf = @getBuffer scope
+  length: (scope, idx) ->
+    buf = @getBuffer scope, idx
     return 0 unless buf
     return buf.length
 
   # Tells if buffer has packets or not
-  ready: (scope) ->
+  ready: (scope, idx) ->
     return @length(scope) > 0
 
   # Clears inport buffers
   clear: ->
-    @buffer = [] if @buffer
-    @scopedBuffer = {} if @scopedBuffer
-
+    @prepareBuffer()
 
 module.exports = InPort

      throw new Error 'Contains query is only possible on buffered ports'
    @buffer.filter((packet) -> return true if packet.event is 'data').length

  getBuffer: (scope) ->
    if scope?
      return undefined unless scope of @scopedBuffer
      buf = @scopedBuffer[scope]

    return if @process
    return if @options.control and ip.type isnt 'data'
    ip.owner = @nodeInstance
    ip.index = id if @isAddressable()

    buf = @prepareBufferForIP ip
    buf.push ip
    buf.shift() if @options.control and buf.length > 1

