solution that runs in 15 secs rather than an hour