Error checking and prettyness
fix some namespacing