Add locking, support for bundled reports, more

Also changed writeImmediate back to write and added enqueue