Incorporated bugfixes from coursera