better way to return an instance of a class