Re-code

New take on same code, fewer functions