WIP for issue #24. still need to update the ajax code