better class handling; test for related