updates to main cleaning up code