Updating last commit, merged issue #17 and issue #10

A better idea to remove the little bug in issue #17. I have merged issue #17 and issue #10 for overview. The idea for the solution for issue #17 is from carmenates09.