refactored code and prepared for actual bigint implementation
don't pass structs by value