unshittied the code as much as i can