changed function placement