added crown calculation and downloading as JSON