optimized parsing

parsing, and code-tidy