syntax clean up and added window.resize listener