Hacky as shit but it works