solve week6 assignment 5 and initialise others