Some refactoring, comments