accomplished tests, refractor code