Removed DBG prints and unneeded type casts.