cleaned up the code function
cleaned up functions
cleaned up the preview function