added validty check