add block manager and add test code