Add in generics, add in the permission check, and clean up.