Refactored overdraft function