Implemented almost entire backend