more refactoring into  functional components