remove begin and end