refactored setup script