Fixed improper function placement