added before_save methods to models