updates based on mr-c's comments
change the coding style