shitty code fixed