Add boundry checking.