Refactored some Javascript code