moved functionality out of getNamespace method to getClass