Bug fixes with edits and added support for token based security