Final refactoring. Now it looks pretty much sexy.