Made the code nicer