Added first version of boundary determination.