Added ajax-loading for data and cleanup code