Made the code a bit better