change logic for edge cases