begin and end blocks working well