Logic layer refactored.