Add docs and throw exception when type is invalid, test coverage