Hacky use of generics to allow for black magic