Fixed logic and when it checks for compacting
Removed unnecessary parameter
Not really sure