For codes used in Project2