Code for my final year project