Cleaned up code, removed println()s. Added clearer comments.