Refactored functionality.py into separate files