remove duplicate init code
add event listeners for moving frame and resizing frame