small fixes and refactoring. gotta keep my current commit streak