refactor for genericness