small refactor and cleanup