more fixes and refactors