Changes to pull #50, please check them ben.