added functionality to gallery