Namespaces

Added namespaces implementation and improved code style and phpdoc