MAJOR FIX: Converted into jQuery functions