A bit more refactory to make things easier to read