Reformatted code
Added namespaces support