Fixed and simplification

Simplified the primitives library and also allowed dirty sets to be
passed through the light system.