@wltrimbl's suggested fixes