bugfix: process now follows the correct chain of events. code is clenaer