last version before incorporating phases shifts