introduced constant INFINITY, other minor changes
minor changes, added tests, added simple regex checks