Added safety check for invalid index
Added vector builtins and library procedures