wip; tying up loose ends on hotfix
refactored a bit
wip; refactoring hotfix