Tweaked position of ajax and outputFormat (now in if...else)w