made better modularizing parsing algorithm thing