radically changed the code around