moved logic to correct files