Added Task concept.
Bug fixes and code clean up.