refactored message registration