Added tests for new functionality.
Added petri net module. Improved readability of all the code.