Changed the sequence of functions location