Refactor workarounds for edge cases into methods