Before Adding Database Support

Working version just before attempting to add database support.