implemented Chapter3 - 5