fixed warnings and formatting
merged