Refactored basic code.