added some validations and a test for it
fixed layout