Fixed some minor bugs, removed debug statements