changed casted array access into method call for getting an input value