Small corrections
Refactored output and small fix