small refactor, changes per comments