refactored from initialize.sh