Final revision of code