trying to simplify code for CodeClimate