Added boundary validation