Formatting and improved some of the frame code