Latest updated code for FYP project.