Applied some refactoring. Fixed windows compatibility. Improved ByteBuffer leak detection.