rework api and add generics