Fixed async loading, code refactoring