refactored and split out components