Shortened solution code by grabbing just the essential functions, not the test_ functions.