Upgraded to use Flatly, and made some minor adjustments elsewhere