Replace vectors with pre-allocated stack arrays