what is a ball mill and how does it function