Refactored invite processing and fixed some t
ypos