Use proper type, rename variables
Remove copy-paste
Code style