Improved version parsing