save before, code clean up