damn. does this do it correctly in both scenarios?