Pushing code from @anhle82.  fixes #11