replaces solution from 22e4e201c740d5f9971b with better one