Changed explicit state passing to proper StateT