Try writing tests for it. This will change your perspective and help you see what it should do. If this doesn't work, check the source into your code repository, delete any code that seems convoluted and start fresh. Both have worked well for me - today in fact.
As humans we are context based, which means that we can get locked into the problems of our solutions. Both methods above enable you to shift your context, and clear your head.