make function more flexible for recalculating frames in the future