Implementing run fucntion