Rewritten to remove jQuery dependency