compress more the copy and paste code