Extract logic into namespaces.