more dynamic attributes function. still needs extracted into a macro
serialization