refactored to package layout
various fixes due to refactor