added compacting tests and also updated some of the code