Direction feature

I have changed static to non-static variable to fix the memory problem, I hope it works.