Started refactoring into authorea-compatible format.