Improvements in block and ui classes.
Added test for BlockFactory.