Worked on selftest routines