This code is more elegant