added invoke, refactored code, turned into package