removed unused classes
(cherry picked from commit 1c48280)
changed flags and masks
(cherry picked from commit 26c0fa6)