Improved handling of frames and added logs