moved db writing to separate handle
update timestamps after notification
FIXME: using different loggers for main.rb and scripts/*
small fixes