ugly, but everything works