refactoring of sapi handling and validator-util