Minor adjustments, refactoring