removing unnecessary begin/end blocks