More work on processing logic, added more documentation as well.