fixed alec's fucked up code