Cleaned up code, and removed debug statements