Finished basic implementation of backend. NOT TESTED