mike made small code improvements