Moved most primitive functions into a special handling section, to reduce boiler-plate setups