Forked simple vs more mature code

Using functions, finally!