Refactoring, addressing review comments