cleaned up comments
fixed switch formatting
fixed indexing error
added debugging method
renamed debug to _debug