Refactor status line function