You should cache `$(elem)` since it's being used so much