Move rest of create & view logic to JS