some improvements for starting and ending