refactor code & add test task