Remove wrong required=mandatory parameter
Add logout mode and layout mode
Change the method to focus a window based on its index
Update comments and remove duplicated code