Use passed in len instead of buffer length
Use passed in len instead of buffer length
Fix typos