extracting function for handling attributes