ajax interval update, refactor and bugfix