Refactoring and a little bit of documentation.