refactor to allow custom transition