minor refactor and cleaning