Made the code more elegant.