Add some checks and remove some white spaces.