Fixes for referal system, shell scripts overworked: