redid last commit and added a small amount of validation