cleanups and refactoring - removing useless code