added effective swap implementation