Made everything work

The code is absolutely terrible.