some rough logic to deal with some more cases