Split select into retain and remove. Improved documentation.
Formatted code according to standard PHPStorm.