Frame function modified