refactor to support more flexible initialization with block constructor