Added more authentication; code refactoring; added support for Chosen should you want it.