Added functionality to write users into csv; fixed import issues in Factory package