Version 1 code for comparison