parsing terminal output, needs clean ups