How abt my solution? does it what you looking for?
Thread