refactor status script