clean up code to not depend on jQuery and other things.