Changes in backend code

You should be able to directly merge these changes. They don't seem to break anything. So you can do further work after merging these changes.