Separated out some of the methods to make the module more flexible.