Implemented all exercises in second chapter