Refactored code to make it more modular
Modified code to actually use invswap.unlimited permission