maybe completed version
logically correct program. it needs more tuned-up..
more testcases
backup while refactoring