minor refactorings
minor bug fixes
preparing for linux