added ajax functions that power most of this modle