Clean up

Turned the code txt file into a java file for ease of use. Cleaned up
the code, by importing needed API's and variable name resolution.