Updated working test code