Several changes

Moved some functions to backend
Function documentation