Added code to write time / site to database