Completed more translation from test to working functions