Move some properties and functions around to their proper locations.
Documentation and slight fixes.