fixed bug with -d, added nicer output