Cleaned up code, got rid of some debugging statements