Added validations. Fixed misc things