improved gallery template