linting and cleanup, take 1

Tried to clean up, but since there are no tests I may have broken someting.