improve status logic