filtering out useless elements