Update location
Restructure code more cleanly