Miscellaneous updates, formatting and tests