Implemented change from review.

- Moved fakeApi to bottom of the file.
- Removed state from MachineAgent as it is not needed.
- Removed commented-out code I missed in the first pass.
- Added comments to some previously private methods.
- Added package documentation to the agent package.