extra chapters and updated in docs + some code cleanups