its ugly, but it works