comments, refactoring + formatting