Added version.
Totally refactored the code.