[CLC-506] Pushing more logic into bash scripts

JIRA: https://jira.media.berkeley.edu/jira/browse/CLC-506