prettier implementation of pan when open