changed implementation to non locale dependant