Added isEmpty function.