Merged changes of ratelle and zackw, thanks!