Code refactoring

http://www.reddit.com/r/haskell/comments/1sj5su/spacesaving_algorithm_in_haskell_approximate_the/ce08jbf