Adds Ajax and Refactoring