update from source
restructure logic