cleaned up contrast calculation