Check resolution.height() also instead of checking resolution.width() twice