Keyboard silent mode issue

White spaces removed

Keyboard silent mode issue, white spaces removed

Added function to reduce duplicate code