added sort unit test and created new function for attribute builder