Refactor registration of posted code