some refactorings
Make status command smarter