Dirty code but it works