webstorm formatting; minor refactoring