Forgot to remove a hardcoded 5 when I was testing, now it actually checks components.size() to create an array of the proper size