small code refactor in the back end