Refactored the descriptor building in order to clean up the register method.