Format source
Rename functions
Extract common code to a function