code refine by divide function and add comment