Removed duplicate code based on recent rebase, fixed nits