Cleanup + small fix
Start breaking down the entry function into smaller functions
Make sure the unit counter is always >= 0
Remove test functions