Added code to verify correctness