code fregment function