Added the getschedule function, and cleaned up for pep8 compliance