Block context

supersedes #57 

/cc @rmsint