Added "quality" as a configurable option
code cleanup