fixing generics unchecked exceptions
general tidying