moved prev functions and listener to source