refactor second prob