refactors code to fetch installed stages
import cleanup
spacing cleanup
adds missing course_id filters to various database calls
adds test to uninstalled stages to check for course id behavior