fix end, and change formatting