underscore internal functions
remove unused function
dir variable scope
the preview functions don't need to exist