Added documentation, improved demo program