Completed database implementation.

Started implementing log system