clean up code and added default timestamp