add comment and change the order of computing