loader added, better error handling