Tables in contracts

Added various optimisations for inserting and organising tables in contracts (e.g. preventing table rows to break across the page or keeping tables together)