Fixed some small bugs

Also improve output format
Continue fixing bugs