Remove lastElement variable since last element can be extracted
by using is() method
Remove Spacing Issue