added cachemean and makeVector