Made the code less stupid