Remove trailing whitespace
Refactor; remove magic numbers