Apply RGB refactoring from issue 203 (and trailing space cleaning)