fixing some bugs / incorrect answers. also did some in ruby