Improved the readability of the code as suggested by @zsyed1