Fixes based on @treyhunner's suggestions