simpiflying the code