Location works, but is very messy.
Added some comments and made location code a little cleaner.