Reworked and improved the frame script.