Moved point calculation to function in seperate file