Added logged of finishing invitation queue and did some code style refactoring