Fix saving routine + adjustable save threshold