Added controller for modal window. Refactored all js-related files