Provided new implementation for character positions
Added distance calculation