add a more elegant solution