Remove unused variable "mid"
Remove unused function "pos"