Move generic functions and clean imports

Move generic functions to separate class and remove unused imports