separated code into better modules