Convert setup script into two components. Fix bugs in script output.