incompleted implementation of matrix boundaries