main script for the learn engine