modified hardcoded upper bounds for bigger images