not pretty but it works ... i think