added optional argument to onPop