Wrote functional code