some minor changes in function 'good'.