added comments and alternate version