Changed $ reference to jQuery whereever applicable to avoid conflict.
Accounted for ajax content loading before listening to the DOMNodeInserted event