Made the code tidier.