Backend code now relates to front end features... NEEDS REFACTOR