Code cleanup, refactoring, and move to eclipse