add ability to auto detect and set maximum resolution