Finally writing the most important part of the module @craigh