refactor into using a recursive data structure allowing for nested
blocks
update assertions to return the correct values according to previous
refactoring
update readme