Added some clarity and checks