Code cleanup.
Creating an internal isFunction function.
Adding a length assertion for Array#splice