now works with classes