Implementing streams 

other minor improvements