toEnd method implemented