Fixed a db bug. Also added popState and pushState to navigate back from the single photo view.