Added orientation framework, small fixes, moved some code to new namespaces.