update/refactor for new Nette and to support apigen