Revert "remove loads of unused code..."

This reverts commit 72715308a9b695fec588a5562a7c0ca9f3fb1736.
move field anywhere code to separate file and document.