revamp and refactor bootstrap script