rearranged code format