Refactored some methods. Closes tests/KoineTests/ArrayReferenceTest.php