basic flow
cleanup and small improvements