A OTP style xerlang port from exercism.io