Final version w also testing code