Major overhaul of AO rendering code