Refactored cs238 stuff out for ease of submitting