Redid optimal width/height calculation...wording in original algorithm is horrible