use erb and refactoring