still not working completely, but code is all present once order of operations/main thread issues are resolved