Made small changes to clean up ajax