Works except for edge case.