cleaned up / optimized and refactore "normalize"