various fixes
refactoring