clean up, and fixed gallery view