Further refactoring: moved files & fixed enrolment

Files have been moved and renamed to be more readable.
A flaw in enrolment was tested and fixed.

client-side javascript simplified.

Jira issue: WP-955