Moved to a class based strucure
created attributes definiction class
cleaned up object creation to minimize code reuse