split up into multiple methods for modularity/testing