Adding a ton of bug fixes and coding style updates