finished, but not tested for strange cases