works, unrefactored