Well, this code works but I have violated everything Ruby Stands For :(