added boundary function