Initial version

Un-optimized code that provides the needed functionality.