refactored the other example