Updated frame function