Difficult merge needed to unify front/backend

I've already been working at a unified version. @JackTanRoo , if this is the correct code that needs to be merged, let's work on this. Otherwise let's close this pull request and get everything merged back into curates/master.