added asynchronous functionality and ajax support