Add __version__ attribute
Move code from lib to script