Basic backend done - bit buggy but mostly there