Completed code.