Code Fixes and Formatting