Code didn't work for me either, but I cleaned it up a bit and made it easier