Added support for Tags and User Properties. Cleaned up some of the code.