Added lots of tests for the substeps. Fixed lots of bugs