Moved the by-hand code in to its own compilation unit