Add comments, basic exception handling for ajax