Improved parsing algorithm, other stuff