moved code for chapters into namespaces