changed the algorithm for figuring out brightness