Fixed some terrible code up