Completed a crude version of the basic functionality.