add TODO
fix minor bug and add small pan optimization