minor changes
made changes based on comments; added test case
made changes based on comments; added test case