Big cleanup and namespace adjustment

Tested this fully and things are still fine :).

Signed-off-by: Chris Sanders <zidane@outlook.com>