Slight performance improvement

thanks to https://gist.github.com/patricksurry/5735048