Refactor; removing duplicate code.
Minified.