Cleaned up everything, made it into a class

it probably works!