More refactoring, introduced underscored internal options, more tests, code reformat (PSR-1, partly PSR-2)