Added the rest of the basic flow logic