added ajax and flags