reorganized code, reduced duplication, updated version and metadata