Added new methods to reduce number of temporary NSData objects created.