updated block creation code