Implemented a better flow but without debugs