Add version, refactor a bit