Move parsing logic to separate file