Added autoclose plugin, few improvements