optional query deferred object support (if jquery is defined); some code styling;