Code tidy
Added abort function