expanded double event functionality, converted repeated operations to functions