modify code a little