Changed speed and buffer variables to be public