cleaned up parsing a bit