Made code more elegant