Fixed issues with namespaces and added in work arounds to handle php functions that aren't aware of current namespace.