Cleaned up javascript for problem 01