more refactorings, frontend cleanup