Improved code

Fixed a bug, removed locale library.