changed to return optional and fixed comments