Somewhat works with generics. I need to clean up code, add comments, and validation