Moved function declaractions to the bottom in patterns file