Fixed serious problems, added some more validations