RT @the_lazy_folder
Sometimes you see ugly code and you try to refactor it but after spending time you realize that the code can't be refactored, it *HAS* to be the way it is.
The problem lies elsewhere.
I'd wager it's the data model.
Your code is a slave to your data model.