fuller implementation with demo