added headers/comments. categorized messages. cleaned code. more cosmetic and formatting related changes.