second solution - kind of janky