Refactoring, minor changes