Treasury main functionality and tests