My final solution