organized imports
minor refactoring, added more debug messages