changed end statements