Direction feature

no more static variables and full functional now.