Started implementing call handling. Minor refactoring.
Removed trailing whitespace.