Lite refactoring and testing