updated codes from assignment 1