initial abuse handling and some refactoring