modularized and added namespaces