Multi-thread synchronization, fixed jUnit tests, reformatted code