Bugfixes for input parser.
Several updates on the implementation.