refactor ex. 1