Added position function
Added another way to get position function
added test statements
Switched to template functions