Added range checks to vector access
cleanup
Added vector reading