Ajax polling and functionality improved