solving problems from book