Further refactoring. Preparing for additional input