Revert "Needs reverting"

This reverts commit 402f8706044d998778f48dfd80cc3fd358044aac.
Write functions started