Added namespace and fixed bug