refactoring reg post handler