latest working version

cleaned up and removed an outdated function
added onFinished function