Fast version. Needs some cleanup, but works