Added checks for existence of jquery selector as well as public functions