Updated to allow for changing window size
Updated to allow for changing window size