added Muhamad code and comments