maxImages variable added