update assembleData to handle factors