more code cleanup and print statements added