Made program parsing code function shorter