Implemented basic bit packing algorithm