Remove unused on and close-to primitives
Improve quality of generated layout code