final code for submission