Bug 919

Please review my changes.

https://gist.github.com/aadamski/f3bc6a24b46a83e24c0d