Minor changes including fix to which time is used when extracting database data.