Refactored event references again and added support for reference arrays and hashes.