ex04

feel free to optimise :)