Added backend code and linked it with the GUI