Add code to create basic-blocks
Fix basic block creation algorithm