getting quite close to functional