start of generic refactor