Using standard library method instead of custom function
AUTHORS: Mention Alexander Malinin
Merge.