my solution implemented