return obj instead of using global variables