Implemented some terrible ruby to make it work