Fix errors in runnable class and add tests to verify them.