Fixed the stupid bug, would be writing some rspec test in the morning