cleaned up code and fixed multiple minor issues