Refactored Javascripts