refactored common project code into separate function