Adjusted returned value in getBrightness() function