added new logic in separation and filling