Cleaned up main, tidied up code and added more informative javadoc comments for encrypt.