Cleaned up the palette code

Removed a platform specific Mono hack workaround and did otherwise only minor source code formatting.