fixing code arrangement