Using Featured Image code to do ajax; fixes some bugs