Deleted debug logging, fixed some bugs