fixed most bugs: needs one more test to work: inval/empty string bug