Corrected a few bugs and added closeTrigger option.