Refactored to zero global variables. Removed the nested ajax requsts. Removed the set interval (lagging the app)