merge and optimize StyleParser and Writer classes