re arranged functions