refactored javascript files