hw6 is working perfectly