Modify to more elegant way