Formatting, fixes, and allocation optimization

Final preparations for completion