Merged positional data function into main javascript file