Updated according to review

Moved listener.beforeBulk up one line, before sempahore.acquire. This also removes the need for the beforeCalled boolean variable.