Cleaned Up Code

Renamed variables, removed unused variables, reorganized debug
printing, moved methods.