comments and nicer output, still ugly code