refactor so it is compliant with cowboy 0.8.2