writing boundary functions