Refactored functionality into inline functions