in reply to why does location of function matter?
The explanation would be easier if we saw your code.