Fixed undefined variable errors
Fixed readability check