simplify texture loader code