Better edge case handling