Edited: async to sync to avoid bugs