Made the code slightly neater