added time, fixed db stuff