Refactored that thing that wasnt working