cleaned up code a lot, just investigating one last thing before code review