Merging with Rhys's stuff
Obstacles
Merged codes from rhy's branch into master