separated code, created tests