refactoring -> made a lot of stuff use generics