some minor changes to the code