make the code more elegant