almost completed issue-22. Need a litle more testing to complete