wrapped stuff up in classes,
added structur for multiple threads