my solution version 2.