Tried to fix this but getting some weird errors