actually handle all the edge cases