Moved some methods into protocols, added documentation