Refactored the code and added the new message form