reviewed the code style for a better reading