Moved interface logic to separate JS file