Debugging statements and more code cleanup