removing unnecessary elements