generic refactoring - 2nd iteration
generic refactoring - 3rd iteration