Little refactoring, improvements