out of the head
log function in, before save
some cleanup