[TIMOB-15000] (3_2_X) Clean up code

Cherry Pick PR #143 into 3_2_X

Fixes [TIMOB-15000](https://jira.appcelerator.org/browse/TIMOB-15000)