refactor and adding status