Remade parsing logic