Cascade where possible

Also, use the module pattern for the Database object