added factory callbacks
fixed variable names