Including final aspects of validation. The code stills very ugly.