Fixed a bug in the setData method and added some docs.