solution for Eric's challenge