refactor the code so it is compliant with rebar OTP application