Fix code quality and copy-paste silliness