refactor to use Optional