Updated code to complete all requirements for the final project