remove all debug prints and fixing minor bugs.