fixes whitespace issues. minor refactoring