Functional version 1.0 - seems to be working. TODO: implement stop
function.