the logic is fucked up I know - let's cleanup this mess