reverted to previous defaults to avoid breaking backward compatibility
made the hardcoded max width and max height limits optional by adding two switch options.