I feel like this section could be done in a more effective way