added block factory

added block factory design pattern