slightly adjust code