garemoko's suggested changes. 

This PR is for my suggested changed. 

I've still got a few more commits to do so please don't merge yet unless you plan to do more work on this yourself.