getting around form caching issue, keeping some funny looking code for performance gain as it has already been written