Some refactoring/renaming/commenting