Plenty of style changes, some validation and small fixes