Reorganizing for ajax refresh