moved script to separate js file.
added bar and refresh function for RAM.