Fix broken functions
 (Still a single known error)
Cleanup by using namespaces