refactored, minor style changes