updated script for frontend part.