Refactored StarDict script