Added more generic function frame_prepare() in init and removed two helper functions.