remove repeated code
fix whitespace