Updated to handle binary data better.