solution implemented as requested