Implemented Erlang day 2 homework