Somewhat polished code.