My working attempt at it