setup of castle complete flow