refactor the code...