Load jQuery before Angular + minor refactoring of some array logic