Move validateCssUnit to separate function