huggggeeee refactor :)