much improved lighting algorithm