re-factored to get view loader working