refactor, some cleanup